package com.zhumo.sz.common.utils;

import java.util.Random;

/**
 * @author zhumo
 * @comment 随机数工具类
 */
public class RandomUtil {

    /**
     * 生成指定大小的随机数
     */
    public static long getRandomNum(long min, long max){
        if (max > Integer.MAX_VALUE || min < Integer.MIN_VALUE || min > max){
            throw new RuntimeException("参数传递异常");
        }
        Random random = new Random();
        return min + (long) (random.nextDouble() * (max - min));
    }
}
